mydir=`pwd`
echo "[Unit]
Description=ROS Launch Service
After=network.target

[Service]
Type=simple
User=${USER}
ExecStart=/bin/bash -c \"source /opt/ros/foxy/setup.bash && source ${mydir}/install/setup.bash && ros2 launch rm_vision_bringup all.launch.py\"
WorkingDirectory=${mydir}

[Install]
WantedBy=default.target
" | sudo tee /etc/systemd/system/ros_launch.service

sudo echo "The file content:"
sudo cat /etc/systemd/system/ros_launch.service

sudo systemctl daemon-reload

sudo systemctl enable ros_launch.service
sudo systemctl start ros_launch.service

sudo systemctl status ros_launch.service
